package com.wyw.design.model.learning.behavioral.mediator;

/**
 * @Title   具体的中介公司-贝克找房
 * @Description
 * @Author Mr Wu yewen.wu.china@gmail.com
 * @Date 2023/4/18 10:54
 * Update History:
 * Author        Time            Content
 */
class MeditorCompanyBeiKe extends MeditorCompany{
    public MeditorCompanyBeiKe(String name) {
        super(name);
    }

    @Override
    void publish(String message, Colleaguer colleaguer) {
        if (colleaguer instanceof ColleagueSeller) { // 如果是卖家发布，则买家进行接收
            buyer.accept(message);
        } else if(colleaguer instanceof ColleagueBuyer) { // 如果是买家发布，则卖家进行接收
            seller.accept(message);
        }
    }
}
